When I try to access a class object variable from outside a class it reads as "undefined"
class Foo {
constructor (arg) {
this.arg = arg;
var bar = {
a: 'Foo'
}
}
}
console.log(Foo.bar);
But it works if I do it inside the class, but I need it outside the class.
class Foo {
constructor(arg) {
this.arg = arg;
var bar = {
a: 'Foo'
};
console.log(bar); //not appearing in the snippet, but it works in a browser
}
};